#pragma once


namespace micro{
namespace gui{


class QWaitCursor
{
	//_NO_COPY( QWaitCursor );
public:
	// Constructor. Simply set the
	// wait cursor.
	QWaitCursor()
	{
		// Set the cursor remembering the
		// old cursor.
		m_hCursor = ::SetCursor( ::LoadCursor( nullptr, IDC_WAIT ));
	}

	// Destructor. Restores the previous cursor.
	virtual ~QWaitCursor()
	{
		// Restore cursor when it was valid. If it was
		// not set the arrow cursor.
		::SetCursor( m_hCursor ? m_hCursor : ::LoadCursor( nullptr, IDC_ARROW ));
	}

	// Restore wait cursor.
	inline void Restore()
	{
		// Restore the wait cursor.
		::SetCursor( ::LoadCursor( nullptr, IDC_WAIT ));
	}
protected:
	// Data.
	HCURSOR m_hCursor;
};


}}//micro